home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / byt86jun.arc / MIDI.ARC / LIST8.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1980-01-01  |  1.6 KB  |  75 lines

  1.  
  2. { Redirect MIDI channel data in a 
  3.   Track Data Block to a new channel
  4. }
  5. procedure change_chan(var tdi,tdo:track_data_block; 
  6.               old_chan,new_chan:byte);
  7. begin
  8. reset_track_data(tdi);
  9. reset_track_data(tdo);
  10. while not(tdi.edat) do
  11.   begin
  12.   next_track_event(tdi);
  13.   with tdi.curr do
  14.     begin
  15.     if (event_type = MIDI_RS) and 
  16.       (midi_chan(running_status) = old_chan) then
  17.       event.mess[1]:=((event.mess[1] and $F0) or new_chan);
  18.     store_track_event(tdo,tdi.curr);
  19.     end;
  20.   end;
  21. end;
  22.  
  23. { Extract a single MIDI channel from a Track Data Block
  24. }
  25. procedure extract_chan(var tdi,tdo:track_data_block; 
  26.                chan:byte);
  27. begin
  28. reset_track_data(tdi);
  29. reset_track_data(tdo);
  30. while not(tdi.edat) do
  31.   begin
  32.   next_track_event(tdi);
  33.   with tdi.curr do
  34.     begin
  35.     if (event_type in [MIDI_RS,MIDI])
  36.       and (midi_chan(running_status) <> chan) then
  37.     begin { convert to NOP }
  38.     event_type:=MARK;
  39.     event_len:=2;
  40.     event.mess[1]:=NOP;
  41.     end;
  42.      end;
  43.   store_track_event(tdo,tdi.curr);
  44.   end;
  45. end;
  46.  
  47. { Filter a MIDI channel from a Track Data Block
  48. }
  49. procedure filter_chan(var tdi,tdo:track_data_block; chan:byte);
  50. begin
  51. reset_track_data(tdi);
  52. reset_track_data(tdo);
  53. while not(tdi.edat) do
  54.   begin
  55.   next_track_event(tdi);
  56.   with tdi.curr do
  57.     begin
  58.     if (event_type in [MIDI_RS, MIDI])
  59.       and (midi_chan(running_status) = chan) then
  60.     begin { convert to NOP }
  61.     event_type:=MARK;
  62.     event_len:=2;
  63.     event.mess[1]:=NOP;
  64.     end;
  65.     end;
  66.   store_track_event(tdo,tdi.curr);
  67.   end;
  68. end;
  69.  
  70.     event_type:=MARK;
  71.     event_len:=2;
  72.     event.mess[1]:=NOP;
  73.     end;
  74.     end;
  75.   store_track_event(tdo,tdi.cu